package com.baidu.foodrecipe.ui.fragment.recipes.details

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.baidu.foodrecipe.R
import com.baidu.foodrecipe.base.BaseFragment
import com.baidu.foodrecipe.databinding.FragmentIngredientsBinding
import com.baidu.foodrecipe.ui.adapters.IngredientsAdapter

class IngredientsFragment : BaseFragment<FragmentIngredientsBinding>() {
    private val detailViewModel: DetailViewModel by activityViewModels()
    private val mAdapter: IngredientsAdapter by lazy { IngredientsAdapter() }

    override fun initUI(savedInstanceState: Bundle?) {
        mBinding.recyclerView.adapter = mAdapter
        mBinding.recyclerView.layoutManager = LinearLayoutManager(requireActivity())
        mAdapter.setNewData(detailViewModel.result!!)
    }
}